﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Yozeev.Migrations
{
    public partial class Add_field_Account : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "PayMethodId",
                schema: "Ticket",
                table: "Accounts",
                maxLength: 65,
                nullable: true);

            migrationBuilder.AddColumn<decimal>(
                name: "RAmount",
                schema: "Ticket",
                table: "Accounts",
                maxLength: 65,
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<long>(
                name: "RQuantity",
                schema: "Ticket",
                table: "Accounts",
                maxLength: 65,
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AddColumn<string>(
                name: "Remark",
                schema: "Ticket",
                table: "Accounts",
                maxLength: 65,
                nullable: true);

            migrationBuilder.AddColumn<decimal>(
                name: "TotalAmount",
                schema: "Ticket",
                table: "Accounts",
                maxLength: 65,
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<long>(
                name: "TotalQuantity",
                schema: "Ticket",
                table: "Accounts",
                maxLength: 65,
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AddColumn<string>(
                name: "VoucherNo",
                schema: "Ticket",
                table: "Accounts",
                maxLength: 65,
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_Accounts_PayMethodId",
                schema: "Ticket",
                table: "Accounts",
                column: "PayMethodId");

            migrationBuilder.AddForeignKey(
                name: "FK_Accounts_PayMethods_PayMethodId",
                schema: "Ticket",
                table: "Accounts",
                column: "PayMethodId",
                principalSchema: "Basics",
                principalTable: "PayMethods",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Accounts_PayMethods_PayMethodId",
                schema: "Ticket",
                table: "Accounts");

            migrationBuilder.DropIndex(
                name: "IX_Accounts_PayMethodId",
                schema: "Ticket",
                table: "Accounts");

            migrationBuilder.DropColumn(
                name: "PayMethodId",
                schema: "Ticket",
                table: "Accounts");

            migrationBuilder.DropColumn(
                name: "RAmount",
                schema: "Ticket",
                table: "Accounts");

            migrationBuilder.DropColumn(
                name: "RQuantity",
                schema: "Ticket",
                table: "Accounts");

            migrationBuilder.DropColumn(
                name: "Remark",
                schema: "Ticket",
                table: "Accounts");

            migrationBuilder.DropColumn(
                name: "TotalAmount",
                schema: "Ticket",
                table: "Accounts");

            migrationBuilder.DropColumn(
                name: "TotalQuantity",
                schema: "Ticket",
                table: "Accounts");

            migrationBuilder.DropColumn(
                name: "VoucherNo",
                schema: "Ticket",
                table: "Accounts");
        }
    }
}
